package com.hsy.dormmanage.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hsy.dormmanage.common.result.Result;
import com.hsy.dormmanage.model.Commodity;
import com.hsy.dormmanage.service.CommoditySer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 包名:com.hsy.dormmanage.controller
 * 用户:86182
 * 时间:20211122:362021/11/16
 */
@Deprecated
@Api("购物模块")
@RestController
@RequestMapping("/dorm/comm")
public class OrderController {
    @Autowired
    private CommoditySer commoditySer;

    @ApiOperation(value = "返回所有商品排行")
    @GetMapping("/list")
    public Result queryBySales(){
        QueryWrapper<Commodity> wrapper = new QueryWrapper<>();
        wrapper.orderByDesc("sales");
        List<Commodity> commodities = commoditySer.list(wrapper);
        return Result.ok(commodities);
    }
}
